<%@ page pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/taglibs.jsp"%>
<html>
	<head>
		<link href="${ctx}/css/main.css" rel="stylesheet" type="text/css" />
		<script language="javascript">
			function submitAction(action){
				document.searchForm.action = action ;
				document.searchForm.submit();
			}
			
			function init() {
				document.getElementById("plantName").value = "";
				document.getElementById("plantCode").value = "";
				document.getElementById("provinceCode").value = "";
			}
			
			function select(action,id){
				location.href = "${ctx}/" + action + "?id=" + id;
			}
		
			function doDelete(action,id){
				if(confirm('是否确认删除？')){
					location.href = "${ctx}/" + action + "?id=" + id ;
				}
			}
		</script>
	</head>
	
	<body>
		<form method="post" action="" name="searchForm">
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td2">
						农产品名
					</td>
					<td width="30%" class="td2">
						<input type="text" name="plantName" size="32" value="${plantArea.plantName}">
					</td>
					<td width="20%" class="td2">
						农产品类别
					</td>
					<td width="30%" class="td2">
						<select name="plantCode" id="plantCode" style="width:200px">
							<option value=""></option>
							<c:forEach var="plantType" items="${sessionScope.T_plantTypeList}">
								<c:if test="${plantArea.plantCode == plantType.plantCode}">
									<option value="${plantType.plantCode}" selected="selected">${plantType.plantCodeName}</option>
								</c:if>
								<c:if test="${plantArea.plantCode != plantType.plantCode}">
									<option value="${plantType.plantCode}">${plantType.plantCodeName}</option>
								</c:if>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2">
						省份
					</td>
					<td width="30%" class="td2">
						<select name="provinceCode" id="provinceCode" style="width:200px">
							<option value=""></option>
							<c:forEach var="province" items="${sessionScope.T_provinceList}">
								<c:if test="${plantArea.provinceCode == province.provinceCode}">
									<option value="${province.provinceCode}" selected="selected">${province.provinceName}</option>
								</c:if>
								<c:if test="${plantArea.provinceCode != province.provinceCode}">
									<option value="${province.provinceCode}">${province.provinceName}</option>
								</c:if>
							</c:forEach>
						</select>
					</td>
					<td width="20%" class="td2">
						
					</td>
					<td width="30%" class="td2">
						
					</td>
				</tr>
				<tr>
					<td class="td11" align="left" colspan="4">
						<input type="button" name="search" value="查询" onClick="submitAction('plantAreaSearch.ac')">
						&nbsp;&nbsp;<input type="button" name="new" value="新增" onClick="submitAction('newPlantArea.ac')">
						&nbsp;&nbsp;<input type="button" name="reset" value="重置" onClick="init()">
					</td>
				</tr>
			</table>
			<BR>
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="10%" class="td1" align="center">
						动作
					</td>
					<td width="30%" class="td1" align="center">
						农产品名
					</td>
					<td width="20%" class="td1" align="center">
						农产品类别
					</td>
					<td width="15%" class="td1" align="center">
						面积（亩）
					</td>
					<td width="15%" class="td1" align="center">
						省份
					</td>
					<td width="10%" class="td1" align="center">
						删除
					</td>
				</tr>
				<c:forEach var="plantArea" items="${plantAreaList}">
					<tr>
						<td class="td2" align="center">
							<a href="javascript:select('selectPlantArea.ac','${plantArea.id}');">选择</a>
						</td>
						<td class="td2">
							${plantArea.plantName}
						</td>
						<td class="td2" align="center">
							${plantArea.plantCodeName}
						</td>
						<td class="td2">
							${plantArea.area}
						</td>
						<td class="td2" align="center">
							${plantArea.provinceName}
						</td>
						<td class="td2" align="center">
							<img src="${ctx}/images/delete0.png" onclick="javascript:doDelete('deletePlantArea.ac','${plantArea.id}');">
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</body>
</html>